from Scheduler import Scheduler
from datetime import datetime, timedelta


testoption1 = {	"option": "1", 
		   "userlist": [{"username": "blow, joe"}], 
		   "window": {"start": "07:00 08/15/14", "end": "17:00 08/15/14"}}

testoption2 = {"option": "2",
			"userlist": [{"username": "blow, joe"},
					{"username": "smith, john"},
					{"username": "bob, billy"},
					{"username": "parker, peggy"}],
			"window": {"start": "07:00 08/15/14", "end": "17:00 08/15/14"}}

testoption3 = {"option": "3",
			"userlist": [{"username": "blow, joe"},
					{"username": "smith, john"},
					{"username": "bob, billy"},
					{"username": "parker, peggy"}],
			"window": {"start": "07:00 08/15/14", "end": "17:00 08/15/14"}}	

def main():
	s = Scheduler()

	#pass complete parameters
	s.params = testoption1
	s.schedule()
	sol = s.solution
	print sol['times']

	s.clearParams()
	print

	# pass parameter by method - pass list of users
	s.option = 2
	dt = datetime.now()
	s.startWindow = dt
	s.endWindow = dt
	s.users = ["blow, joe", "rotten, johnny"]
	s.schedule()
	sol = s.solution
	print sol['attendees']
	print s.option
	print s.startWindow
	print s.endWindow
	print s.users

	s.clearParams()
	print

	# pass parameters by method - add users one at a time
	s.option = 3
	dt = datetime.now()
	s.startWindow = dt
	s.endWindow = dt
	s.addUser = "smith, john"
	s.addUser = "Bellafonte, Harry"
	s.schedule()
	sol = s.solution
	print sol['times']
	print s.option
	print s.startWindow
	print s.endWindow
	print s.users
	

if __name__ == "__main__":
    main()